#!/usr/bin/env python
#coding: utf-8
'''
Created on 2017年3月4日

@author: Administrator
'''
from ioffice import settings
from funcresource.models import UserResource

def get_childrent_source(user, source):
    data = []
    usources = UserResource.objects.filter(user=user, resource__state=settings.StateEnum.VALID, resource__parent=source, state=settings.StateEnum.VALID)
    for usource in usources:
        record = {
            "name":usource.resource.name,
            "url":usource.resource.url,
        }
        data.append(record)
    return data
